import request from './request'
import _, { clone } from 'lodash'


const preUrl = process.env.NODE_ENV === 'production' ? 'http://gbtest.xiniuauto.com/api' : '/api'

//登陆
export const LoginApi = (data) => request.post(preUrl + '/Adm_Login/Adm_UserLogin', data);
//统计
export const CountApi = (data) => request.post(preUrl + '/Adm_Manage/Adm_LoadCountByPage', data)
//团购活动->小龙直营/团购活动
export const ProductApi = (data) => request.post(preUrl + '/Adm_Release/Adm_LoadGBProductByPage', data)
//团购活动->小龙直营/团购活动 => 生成新增团购码
export const GetGBNumber = data => request.get(preUrl + '/Adm_Release/Adm_GetGBNumber', { params: data })
//团购活动->小龙直营/团购活动/添加列表
export const EditGroupBuyProductList = (data) => request.post(preUrl + '/Adm_Release/Adm_EditGroupBuyProductList', data)
//团购活动->小龙直营/团购活动/查看列表/Adm_Release/Adm_DeleteGroupBuyProductList
export const LoadGroupBuyProductList = (data) => request.post(preUrl + '/Adm_Release/Adm_LoadGroupBuyProductList', data)
//团购活动->小龙直营/团购活动/详情
export const LoadGroupBuyProductByNumber = (data) => request.post(preUrl + '/Adm_Release/Adm_LoadGroupBuyProductByNumber', data)
//团购活动->小龙直营/团购活动/详情 => 
export const DeleteGroupBuyProductList = (data) => request.post(preUrl + '/Adm_Release/Adm_DeleteGroupBuyProductList', data)
//团购活动->小龙直营/团购活动 =>删除
export const DeleteGroupBuy = (data) => request.post(preUrl + '/Adm_Release/Adm_DeleteGroupBuy', data)
//团购活动->小龙直营/团购活动 =>添加
export const addGroupBuy = (data) => {
  const cloneData = _.cloneDeep(data)
  // delete cloneData.GroupBuyEndTime
  // delete cloneData.GroupBuyStartTime
  cloneData.GroupBuyContentCode = JSON.stringify(cloneData.GroupBuyContentCode)
  cloneData.GroupBuyStatus = 1;
  cloneData.GroupBuyBgImgId = 1;
  console.log(cloneData)
  debugger
  return request.post(preUrl + '/Adm_Release/Adm_EditGroupBuyProduct', cloneData)
  console.log(data)

}
//商品管理
export const ProductsApi = (data) => request.post(preUrl + '/Adm_Product/LoadProductsByPage', data)
//商品管理 商品详情
export const GetProducts = (data) => request.post(preUrl + '/Adm_Product/GetProductsByNumber', data)
//商品管理 => 添加
export const AddProducts = (data) => request.post(preUrl + '/Adm_Product/AddProducts', data)
//商品管理 => 添加 =>上传地址
export const UploadImgFile = (data) => request.post(preUrl + '/Adm_System/UploadImgFile', data)
//商品管理 => 删除
export const DeleteProduct = (data) => request.post(preUrl + '/Adm_Product/DeleteProduct', data)
//商品管理 => 批量删除
export const DeleteListProduct = (data) => request.post(preUrl + '/Adm_Product/DeleteListProduct', data)
//报表 团长
export const OrderFinanceToExcelApi = (data) => request.post(preUrl + '/Adm_Order/Adm_OrderFinanceToExcelByPage', data)
//报表 供应商
export const SUOrderFinanceToExcellApi = (data) => request.post(preUrl + '/Adm_Order/Adm_SUOrderFinanceToExcelByPage', data)
//订单管理 
export const LoadOrder = (data) => request.post(preUrl + '/Adm_Order/Adm_LoadOrderByPage', data)
//供应商 => 提现 => 审核
export const Manage = (data) => request.post(preUrl + '/Adm_Manage/CheckCutomer', data)

export const LoadOrderProduct = (data) => request.post(preUrl + '/Adm_Order/Adm_LoadOrderProductByPage', data)
//团长=>提现审核 
export const LoadWithdrawCheck = (data) => request.post(preUrl + '/Adm_Check/Adm_LoadWithdrawCheckByPage', data)
//团长=>团长审核 
export const LoadSalesManCheck = (data) => request.post(preUrl + '/Adm_Check/Adm_LoadSalesManCheckByPage', data)
//团长=>团长管理 
export const LoadSalesMan = (data) => request.post(preUrl + '/Adm_Manage/Adm_LoadSalesManByPage', data)
//供应商=> 管理
export const LoadSuppliers = (data) => request.post(preUrl + '/Adm_Manage/Adm_LoadSuppliersByPage', data)
//供应商=> 管理 => 冻结/解冻
export const BanSalesMan = (data) => request.post(preUrl + '/Adm_Manage/Adm_BanSalesMan', data)
//供应商=> 管理 => 设为上级
export const UpdateSalesManIsInvite = (data) => request.post(preUrl + '/Adm_Manage/Adm_UpdateSalesManIsInvite', data)
//供应商=> 管理 => 取消上级
export const DeleteSalesManIsInvite = (data) => request.post(preUrl + '/Adm_Manage/Adm_DeleteSalesManIsInvite', data)
//供应商=> 管理 => 冻结/解冻
export const SalesManInfo = (data) => request.post(preUrl + '/Adm_Manage/Adm_LoadSalesManInfo', data)
//供应商=> 管理 =>删除
export const DeleteSupplier = (data) => request.post(preUrl + '/Adm_Manage/Adm_DeleteSupplier', data)
//供应商=> 管理 =>增加
export const AddSupplier = (data) => request.post(preUrl + '/Adm_Manage/Adm_AddSupplier', data)
//团长=> 对账报表
export const OrderFinanceToExcel = (data) => request.post(preUrl + '/Adm_Order/Adm_OrderFinanceToExcelByPage', data)
//海报 
export const PostApi = (data) => request.post(preUrl + '/Adm_Release/Adm_LoadGBPosterByPage', data)
//海报 删除海报
export const DeleteGBPoster = (data) => request.post(preUrl + '/Adm_Release/Adm_DeleteGBPoster', data)
//海报 新增海报
export const AddGBPoster = (data) => request.post(preUrl + '/Adm_Release/Adm_AddGBPoster', data)
//小龙直营 新增商品 添加
export const SelectProducts = (data) => request.post(preUrl + '/Adm_Release/Adm_SelectProductsByPage', data)
//提成点
export const AddSalesManCommission = (data) => request.post(preUrl + '/Adm_Manage/Adm_AddSalesManCommission', data)
//对账报表（供应商）时间搜索
export const SUOrderFinanceByTime = (data) => request.post(preUrl + '/Adm_Order/Adm_SUOrderFinanceByTime', data)


//导出
export const OrderFinanceToExcelAPI = (data) => request.post(preUrl + '/Adm_Order/Adm_OrderFinanceToExcel', data)

